﻿package prototype_pattern;

import java.util.Date;
import java.util.concurrent.TimeUnit;

/**
 * @author cbf4Life cbf4life@126.com
 * I'm glad to share my knowledge with you all.
 */
public class Client {


	public static void main(String[] args) {
		//产生一个对象
		Thing thing = new Thing();
		//设置一个值
		thing.setValue("张三");
		thing.setValue("abcd");
		thing.setUser(new User("name"));
		thing.setTestStr("testStr");
		Date date = new Date();
		thing.setDate(date);
		System.out.println(date);
		try {
            TimeUnit.SECONDS.sleep(2);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
		//拷贝一个对象
		Thing cloneThing = thing.clone();
		cloneThing.setValue("李四");
		cloneThing.setTestStr("testStr22222222222");
		cloneThing.setDate(new Date());
		cloneThing.getUser().setName("name222222222");
		System.out.println(thing.getValue());
		System.out.println(thing.getTestStr());
		System.out.println(thing.getDate());
		System.out.println(thing.getUser().toString());
	}

}
